package com.webull.information.client.model;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 新闻model
 * 
 * @author shimingjun
 * @date 2016年7月11日 下午6:51:54
 * @version 1.0
 * @since JDK 1.8
 */
public class News implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4486061726450123894L;
	/**
	 * 主键id
	 */
	private Long id;
	/**
	 * 新闻标题
	 */
	private String title;
	/**
	 * 首页资讯
	 */
	/**
	 * 新闻摘要
	 */
	private String summary;
	/**
	 * 摘要签名(结果)
	 */
	private String sumMd5;
	/**
	 * 存储标记(一般是文件夹名称)
	 */
	private String storeShard;
	/**
	 * 存储格式
	 */
	private String storeFormat;
	private String storeVersion;
	/**
	 * 新闻主图
	 */
	private String mainPic;
	/**
	 * 新闻时间
	 */
	private Date newsTime;
	/**
	 * 新闻来源
	 */
	private String sourceName;
	/**
	 * 新闻链接地址
	 */
	private String url;
	private String urlMd5;

	private String content;
	/**
	 * 新闻所属地区id
	 */
	private Integer regionId;
	private String language;
	/**
	 * 创建时间
	 */
	private Date createTime;
	/**
	 * 修改时间
	 */
	private Date updateTime;
	/**
	 * 同步美国S3
	 */
	private Boolean syncUs;

	private Integer siteType = SiteType.NORMAL;// '资源类型:0,普通网页,1为聚合类型';

	public Boolean getSyncUs() {
		return syncUs;
	}

	public void setSyncUs(Boolean syncUs) {
		this.syncUs = syncUs;
	}

	/**
	 * 是否删除
	 */
	private Boolean del;

	/**
	 * 采集来源
	 */
	private String collectSource;

	private Integer homePage;

	public Integer getHomePage() {
		return homePage;
	}

	public void setHomePage(Integer homePage) {
		this.homePage = homePage;
	}

	public String getCollectSource() {
		return collectSource;
	}

	public void setCollectSource(String collectSource) {
		this.collectSource = collectSource;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getUrlMd5() {
		return urlMd5;
	}

	public void setUrlMd5(String urlMd5) {
		this.urlMd5 = urlMd5;
	}

	public String getSumMd5() {
		return sumMd5;
	}

	public void setSumMd5(String sumMd5) {
		this.sumMd5 = sumMd5;
	}

	public String getLanguage() {
		return language;
	}

	public String getStoreFormat() {
		return storeFormat;
	}

	public void setStoreFormat(String storeFormat) {
		this.storeFormat = storeFormat;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	public String getStoreShard() {
		return storeShard;
	}

	public void setStoreShard(String storeShard) {
		this.storeShard = storeShard;
	}

	public String getMainPic() {
		return mainPic;
	}

	public void setMainPic(String mainPic) {
		this.mainPic = mainPic;
	}

	public Date getNewsTime() {
		return newsTime;
	}

	public void setNewsTime(Date newsTime) {
		this.newsTime = newsTime;
	}

	public String getSourceName() {
		return sourceName;
	}

	public void setSourceName(String sourceName) {
		this.sourceName = sourceName;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Integer getRegionId() {
		return regionId;
	}

	public void setRegionId(Integer regionId) {
		this.regionId = regionId;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public Boolean getDel() {
		return del;
	}

	public void setDel(Boolean del) {
		this.del = del;
	}

	public String getStoreVersion() {
		return storeVersion;
	}

	public void setStoreVersion(String storeVersion) {
		this.storeVersion = storeVersion;
	}

	public Integer getSiteType() {
		return siteType;
	}

	public void setSiteType(Integer siteType) {
		this.siteType = siteType;
	}

	/**
	 * 索引文件比较 是否需要更新索引
	 * 
	 * @param other
	 * @return
	 * @since 0.1.0
	 */
	@JsonIgnore
	public boolean compareIndex(News other) {

		if (other == null || id == null || !id.equals(other.getId()))
			return false;

		if (getHomePage() != null && !getHomePage().equals(other.getHomePage()))
			return false;
		if (getStoreShard() != null && !getStoreShard().equals(other.getStoreShard()))
			return false;
		if (getNewsTime() != null && !getNewsTime().equals(other.getNewsTime()))
			return false;
		if (getUrlMd5() != null && !getUrlMd5().equals(other.getUrlMd5()))
			return false;
		return true;
	}

	public static class CollectSource {

		public static final String hengSheng = "hengSheng";// 恒生电子
		public static final String Google = "google";//
		public static final String Cnbc = "cnbc";//
		public static final String Yahoo = "yahoo";//
		public static final String Bloomb = "bloomb";//
		public static final String sinaCn = "sinaCn";//
		public static final String mCtrol = "mCtrol";// 印度http://www.moneycontrol.com/
		public static final String reutersEn = "reutersEn";//
		public static final String reutersGuide = "reutersGuide";// 路透api
		public static final String wallStreet = "wallStreet";// 华尔街见闻
		public static final String R1Cai = "21Cai";// 21财经
	}

	public static class SiteType {
		/*
		 * 资源类型:0,普通网页,1为聚合类型';
		 */
		public static final Integer NORMAL = 0;
		public static final Integer PIRORIT = 1;
	}

	public static class HomeType {
		/*
		 * 新闻类型:0,普通网页,1为home';2为topNews
		 */
		public static final Integer little = 0;
		public static final Integer home = 1;
		public static final Integer top = 2;
		public static final Integer frontPage = 3;
	}
}
